<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
		/*
		  创建方式:
		  1.字面量 ""
		  2.new String()
		*/
			var s = "abcdefghijklmnopqrstuvwxyz";
			console.log(s.charAt(2));
			console.log(s.endsWith("yz"))
			console.log(s.indexOf("h"));
			console.log(s.lastIndexOf("h"));
			console.log(s.substring(1, 6));
			console.log(s.replaceAll("f", "F"));

			var s2 = new String("6789  ");
			console.log(s2.trim());

			//"dafdfsdgfujopewroperlgjlrkgskfhkfhskjkjks" 统计f出现的次数

			var s3 = "dafdfsdgfujopewroperlgjlrkgskfhkfhskjkjks";
			var count = 0;
			var index = s3.indexOf("f");
			while ((index = s3.indexOf("f")) != -1) {
				s3 = s3.substring(index + 1);
				count++;
			}
		</script>
	</head>
	<body>
	</body>
</html>
